<template>
	<view class="goods-box" @click="ClickHandler">
		<view class="goods-picture">
			<image :src="goods.goods_icon || defaultPic" mode="widthFix"></image>
		</view>
		<view class="goods-data">
			<text class="goods_name">{{goods.goods_name}}</text>
			<text class="goods_price" style="color: #008000;">￥{{goods.goods_price}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name:"my-goods",
		data() {
			return {
				defaultPic: 'https://img3.doubanio.com/f/movie/8dd0c794499fe925ae2ae89ee30cd225750457b4/pics/movie/celebrity-default-medium.png'
			};
		},
		props:{
			goods:{
				type:Object,
				default:null
			}
		},
		methods:{
			ClickHandler(){
				this.$emit('click')
			}
		}
	}
</script>

<style lang="scss">
	.goods-box{
		display: flex;
		align-items: center;
		height: 100px;
		background-color: white;
		margin-bottom: 1px;
		padding: 5px;
		border-bottom: #fefefe solid 1px;
		.goods-picture{
			image{
				width: 100px;
			}
		}
		.goods-data{
			height: 100%;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			align-items: flex-start;
			.goods_name{
				font-size: 12px;
			}
			.goods-price{
				color: #008000;
				font-size: 30;
			}
		}
	}
</style>